<?php
namespace app\shop\controller;

use x\Container;

class Fahuo extends Base
{

    //快递列表
    public function lists(){
        if(is_post()){
            $eid = $this->post("eid");
            //删除
            $this->db->delete("shop_express",$this->userinfo['id'],"shop_id");
            if(isset($eid) && is_array($eid)){
                $data = [];
                foreach ($eid as $k => $v) {
                    $data[] = ['shop_id'=>$this->userinfo['id'],'express_id'=>$v,'create_time'=>time()];
                }
                $this->db->insertAll('shop_express',$data);
            }
            cookie('js_msg','保存成功');
            cookie('js_function','reload');
            return suc();
        }
        $elist = $this->db->query("select * from express where status = ?",[0]);
        $mlist = $this->db->query("select * from shop_express where shop_id = ?",[$this->userinfo['id']]);

        $this->fetch(['elist'=>$elist,'mlist'=>$mlist]);
    }

}

?>
